/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-03-27
 * Time: 23:44
 */
public class Demo1 {
    public  static  boolean flg=true;
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(()->{
            while(flg){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        thread.start();
        for (int i = 0; i < 3; i++) {
            System.out.println("hello main");
            Thread.sleep(1000);
        }
        flg=false;
        Thread.sleep(1000);

        System.out.println(thread.isAlive());
    }
}
